package com.by.service.impl;

import com.alibaba.csp.sentinel.Entry;
import com.alibaba.csp.sentinel.SphU;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.by.service.OrderService;

import java.util.HashMap;
import java.util.Map;

//@Service
public class OrderServiceImpl implements OrderService {
    @Override
    public Map get() {
        Map map = new HashMap();
        Entry entry = null;//资源
        try {
            //定义资源
            entry = SphU.entry("查询订单");
            Thread.sleep(1100);
            map.put("id", "1");
            map.put("orderNum", "dd2024000101111111111111111");
        } catch (BlockException e) {
           map.put("code",0);
           map.put("msg","查询订单失败");
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } finally {
          if(null!=entry)
              entry.exit();//释放
        }

        return map;
    }
}
